<template>
	<view>
		<cu-custom class="" bgColor="bgmains" :isBack="true">
		    <view slot="content">我的团队</view>
		</cu-custom>
		
		<view v-if="dataList.length==0" class="text-center margin-top text-lg">暂无数据~</view>
		<view class="margin box padding" v-for="(item,index) in dataList" :key="index" @click="go('/gc_school/pages/distribution/team2?uid='+item.u_id)">
			<view class="flex align-center">
				<image class="avatar" :src="item.avatar"></image>
				<view class="userinfo">
					<view class="nickname">{{item.nickname}}</view>
					<view class="date">{{item.create_time | formatDate}} <text>下级{{item.child}}人</text></view>
				</view>
				<text class="cuIcon-right"></text>
			</view>
			<!-- <view class="profit">贡献收益：<text class="text-bold">￥{{item.money}}</text></view> -->
		</view>
		
		
	</view>
</template>

<script>
	var app = getApp()
	export default{
		data(){
			return{
				page:1,
				is_loadmore:true,
				dataList:[],
			}
		},
		onLoad() {
			this.getLst()
		},
		onReachBottom() {
			if(this.is_loadmore)
			{
				this.page++
				this.getLst()
			}
			else{
				uni.showToast({
					title:'没有更多数据~',
					icon:'none'
				})
			}
		},
		methods:{
			getLst() {
				const self = this;
				app.globalData.util.request({
					url: 'Distribution/myteam',
					data: {
						limit:10,
						page:self.page,
					},
					success(res) {
						if(res.data.data.length<10)
						{
							self.is_loadmore = false
						}
						self.dataList = self.page==1?res.data.data:[
							...self.dataList,...res.data.data
						]
					}
				}, true);
			},
		}
	}
</script>

<style lang="scss">
	page{
		background-color: #F7F5F6;
	}
	.bgmains{
		background-color: white !important;
	}
	.box{
		background-color: white;
		border-radius: 10rpx;
		.avatar{
			width: 90rpx;
			height: 90rpx;
			border-radius: 50%;
			margin-right: 20rpx;
		}
		.userinfo{
			flex-grow: 1;
			.nickname{
				font-size: 30rpx;
				color: #121212;
				font-weight: bold;
			}
			.date{
				margin-top: 10rpx;
				color: #666666;
				font-size: 22rpx;
				text{
					font-size: 24rpx;
					margin-left: 20rpx;
				}
			}
		}
		.profit{
			margin-top: 30rpx;
			background-color: #FBFBFB;
			border-radius: 10rpx;
			padding: 30rpx;
			color: #121212;
			font-size: 26rpx;
			font-weight: bold;
			text{
				color: #FF4C49;
				font-size: 30rpx;
			}
		}
	}
</style>